# Maintainer: Guy Godfroy <guy.godfroy@gugod.fr>
pkgname=py3-dataclasses-serialization
pkgver=1.3.1
pkgrel=2
pkgdesc="Serialize/deserialize Python dataclasses"
url="https://github.com/madman-bob/python-dataclasses-serialization"
arch="noarch"
license="MIT"
depends="
	py3-more-properties
	py3-toolz
	py3-toposort
	py3-typing_inspect
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-pytest-forked
	py3-pytest-xdist
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/madman-bob/python-dataclasses-serialization/archive/refs/tags/$pkgver.tar.gz
	$pkgname-fix-deserialize.patch::https://github.com/madman-bob/python-dataclasses-serialization/commit/00fbd280034abeff277523a6579f14d10e8427a2.diff
	root.patch
	"
builddir="$srcdir/python-dataclasses-serialization-$pkgver/"

prepare() {
	default_prepare

	# fixup location
	mv pypi_upload/setup.py .
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	# https://github.com/madman-bob/python-dataclasses-serialization/issues/16
	.testenv/bin/python3 -m pytest -n auto --forked \
		-k 'not test_json_serialization_types'
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
5dc3569675749c82aaf1d9a8e2507fa9a2ee2bb14d6cb082fde15a108e4651afbdb0b1d6c8ca60dca839206abfca2c10b0fc9efe4867e521c1522a7a68b8a7c1  py3-dataclasses-serialization-1.3.1.tar.gz
4febeff6f08f12267fdceb1243449099c16002c3731cdde80a841a3d63fcb27333ae871fd8d05f45ee8881eccc77b69e8bc6b737ccb49d3c55cb008b49e32762  py3-dataclasses-serialization-fix-deserialize.patch
78c1714b7373586fcf67adc5dd3ec39b42f9f4cd03cad705d568cbc45de10f506e04a76d112b5cc6ea9b3e0e110f32dd4b9163a3eddeecc1fc94237887b4ed45  root.patch
"
